/*
 * Cache.java
 *
 * Created on January 3, 2008, 7:34 PM
 *
 * Copyright (C) 2007-2008  Hylke van der Schaaf
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, in version 3 of the License.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

package hextd.util;

import java.awt.Shape;
import java.awt.image.BufferedImage;
import java.util.HashMap;

/**
 *
 * @author hylke
 */
public class Cache {
    
    private HashMap<String, BufferedImage[]> cBufImgArr;
    private HashMap<String, Shape[]> cShapeArr;
    private HashMap<String, Shape> cShape;
    
    /** Creates a new instance of Cache */
    public Cache() {
        this.cBufImgArr = new HashMap<String, BufferedImage[]>();
        this.cShapeArr = new HashMap<String, Shape[]>();
        this.cShape = new HashMap<String, Shape>();
    }
    
    public void clearCache() {
        this.cBufImgArr.clear();
        this.cShapeArr.clear();
        this.cShape.clear();
    }
    
    
    public boolean hasBufImgArr(String name) {
        return this.cBufImgArr.containsKey(name);
    }
    public void putBufImgArr(String name, BufferedImage[] a) {
        this.cBufImgArr.put(name, a);
    }
    public BufferedImage[] getBufImgArr(String name) {
        return this.cBufImgArr.get(name);
    }
    
    
    public boolean hasShapeArr(String name) {
        return this.cShapeArr.containsKey(name);
    }
    public void putShapeArr(String name, Shape[] a) {
        this.cShapeArr.put(name, a);
    }
    public Shape[] getShapeArr(String name) {
        return this.cShapeArr.get(name);
    }
    

    public boolean hasShape(String name) {
        return this.cShape.containsKey(name);
    }
    public void putShape(String name, Shape a) {
        this.cShape.put(name, a);
    }
    public Shape getShape(String name) {
        return this.cShape.get(name);
    }
    
}
